package com.ctshk.rpc.localfun.enums;

import com.ctshk.common.enums.OrderSource;

import java.util.Arrays;

/**
 * @Description
 * @Author wansi <gaylen15527491065@yeah.net>
 * @Date 2021/4/12
 */
public enum ApproveStatusEnum {

    PENDING(1, "待審批"),
    PROCESSED(2, "審批中"),
    PASS(3, "審批通過"),
    NOPASS(4, "審批不通過"),
    ABLED(5, "有效"),
    DISABLED(6, "無效");

    private Integer code;
    private String name;

    ApproveStatusEnum( Integer code, String name) {
        this.code = code;
        this.name = name;
    }


    /**
     * 通过key拿订单状态名称
     * gzl-wansi001
     * @param code
     * @return
     */
    public static String getApproveStatusName(Integer code){
        ApproveStatusEnum orderPaymentStatus = Arrays.stream(ApproveStatusEnum.values())
                .filter(enums -> enums.getCode().equals(code)).findFirst().orElse(null);

        if(orderPaymentStatus != null){
            return orderPaymentStatus.getName();
        }
        return "";
    }

    public Integer getCode() {
        return code;
    }
    public String getName() {
        return name;
    }
}
